import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'
import Register from '../views/Register.vue'
import Home from '@/components/Section/Home.vue'
import Film from '@/components/Section/Film.vue'
import index from '@/views/index.vue'
import Activity from '@/components/Section/Activity.vue'
import LeaveMsg from '@/components/Section/LeaveMsg.vue'
import Person from '@/components/Section/Person.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:'/Login',
    name:'Login',
    component:Login
  },
  {
    path:'/Register',
    name:'Register',
    component:Register
  },
  {
    path:'/index',
    name:'index',
    component:index,
    redirect:'/index/Home',
    children:[
      // 首页
      {
        path:'Home',
        name:'Home',
        component:Home
      },
      // 电影页面
      {
        path:'Film',
        name:'Film',
        component:Film
      },
      // 活动页面
      {
        path:'Activity',
        name:'Activity',
        component:Activity
      },
      // 留言页面
      {
        path:'LeaveMsg',
        name:'LeaveMsg',
        component:LeaveMsg
      },
      // 个人中心
      {
        path:'Person',
        name:'Person',
        component:Person,
        redirect:'Person/ShoppingCar',
        children:[
          {
            path:'ShoppingCar',
            name:'ShoppingCar',
            component:()=>{
              return import('@/components/Person/ShoppingCar.vue')
            }
          },
          {
            path:'Order',
            name:'Order',
            component:()=>{
              return import('@/components/Person/Order.vue')
            },
          },
          {
            path:'BasicSetting',
            name:'BasicSetting',
            component:()=>{
              return import('@/components/Person/BasicSetting.vue')
            }
          }
        ]
      },
      // 电影详情页面
      {
        path:'Details',
        name:'Details',
        redirect:'/index/Details/FilmDetail',
        component:()=>
          import ('@/components/Section/Details'),
        children:[
        {
          path:'FilmDetail',
          name:'FilmDetail',
          component:()=>
            import('@/components/FilmDetails/FilmDetail')
        },
        {
          path:'FilmTicket',
          name:'FilmTicket',
          component:()=>
            import('@/components/FilmDetails/FilmTicket')
        }
      ]
      },
      // 购票页面
      {
        path:'ChooseSeat',
        name:'ChooseSeat',
        component:()=>
          import('@/components/Section/ChooseSeat.vue')
      }
    ]
  },
  {
    path:'/',
    name:'Login',
    component:Login,
  }
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  linkExactActiveClass:"active",
  routes
})

export default router
